package Controller;

import Model.Country;
import Model.CreateCSV;
import Model.Interestrates;
import UI.WelcomeScreen;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;

/**
 *
 * @author HaTschE
 * 
 * This project allows to convert the WorldBank data into a WEKA readable CSV file
 * 
 */
public class Main {

    public static Main CONTROL;
    private ArrayList<Country> countries;
    private ArrayList<Interestrates> interestrates;
    private ArrayList<Double> interestrateValues;
    // Create training or test file
    public static boolean TEST = false;

    public static void main(String[] args) {
        CONTROL = new Main();
        JFrame welcome = new WelcomeScreen();
        welcome.setSize(380, 200);
        welcome.setLocation(0, 0);
        welcome.setVisible(true);
    }

    public Main() {
        countries = new ArrayList<Country>();
        interestrates = new ArrayList<Interestrates>();
        interestrateValues = new ArrayList<Double>();
        percentages = new int[]{97, 3};
    }

    public ArrayList<Double> getInterestrateValues() {
        return interestrateValues;
    }

    public void setInterestrateValues(ArrayList<Double> interestrateValues) {
        this.interestrateValues = interestrateValues;
    }

    public ArrayList<Interestrates> getInterestrates() {
        return interestrates;
    }

    public void setInterestrates(ArrayList<Interestrates> interestrates) {
        this.interestrates = interestrates;
    }
    private int[] percentages;

    public int[] getPercentages() {
        return percentages;
    }

    public void setPercentages(String save, String crisis) {
        this.percentages[0] = Integer.parseInt(save);
        this.percentages[1] = Integer.parseInt(crisis);
    }

    public ArrayList<Country> getCountries() {
        return countries;
    }

    public void addCountry(Country country) {
        countries.add(country);
    }

    /**
     * @param args the command line arguments
     */
    public void excludeIndicator(int indicatorIndex) {
        for (int i = 0; i < Controller.Main.CONTROL.getCountries().size(); i++) {
            Controller.Main.CONTROL.getCountries().get(i).getIndicators().get(indicatorIndex).setFlag(false);
        }
    }
}
